#include "StdAfx.h"
#include "LayoutStructs.h"

namespace fusion
{
	namespace mode10
	{
		/*
         * MeasureSpec
         */
        MeasureSpec::MeasureSpec() {};
		fusion::Ref<MeasureSpec> MeasureSpec::GenerateMeasureSpec(int size, MeasureMode mode)
        {
			fusion::Ref<MeasureSpec> spec = new MeasureSpec();
            
            spec->Size = size;
            spec->Mode = mode;
            return spec;
        }

		/*
         * BaseLayoutParams
         */
        const int BaseLayoutParams::WRAP_CONTENT = -2;
        const int BaseLayoutParams::MATCH_PARENT = -1;

        BaseLayoutParams::BaseLayoutParams(int width, int height):
        m_Height(height),
        m_Width(width)
        {}

        BaseLayoutParams::BaseLayoutParams(const BaseLayoutParams& params):
        m_Height(params.m_Height),
        m_Width(params.m_Width)
        {}

        void BaseLayoutParams::SetHeight(int height) { m_Height = height; }
        void BaseLayoutParams::SetWidth(int width) { m_Width = width; }

		 /*
         * MarginLayoutParams
         */
        const int MarginLayoutParams::MarginLeft = 1;
        const int MarginLayoutParams::MarginRight = 2;
        const int MarginLayoutParams::MarginTop = 3;
        const int MarginLayoutParams::MarginBottom = 4;

        MarginLayoutParams::MarginLayoutParams(int width, int height):
                BaseLayoutParams(width, height),
                m_LeftMargin(0),
                m_RightMargin(0),
                m_TopMargin(0),
                m_BottomMargin(0)
        {}

        MarginLayoutParams::MarginLayoutParams(const MarginLayoutParams& params):
                BaseLayoutParams(params),
                m_LeftMargin(params.m_LeftMargin),
                m_RightMargin(params.m_RightMargin),
                m_TopMargin(params.m_TopMargin),
                m_BottomMargin(params.m_BottomMargin)
        {}

        void MarginLayoutParams::SetMargins(int left, int top, int right, int bottom)
        {
            m_LeftMargin = left;
            m_TopMargin = top;
            m_RightMargin = right;
            m_BottomMargin = bottom;
        }
	}
}